package com.example.travel.util;

import com.github.pagehelper.PageInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultUtil {

    private String code;// 状态码
    private String msg; // 错误信息
    private Long count; // 总条数
    private Object data; // 返回数据


    public static ResultUtil ok(PageInfo pageInfo) {
        return new ResultUtil("0","",pageInfo.getTotal(),pageInfo.getList());
    }

    public static ResultUtil ok(Long count,Object data) {
        return new ResultUtil("0","",count,data);
    }

    public static ResultUtil ok(Object data) {
        return new ResultUtil("0","",0L,data);
    }



}
